const meet = require("../../database/meetingRoom");
module.exports = async (req, res, next)=>{
  const {rId, number, config, rName, state} = req.body;

  if(req.power !== 0){
    res.send({
      code:4,
      msg:"权限不够"
    })
    return;
  }

  if(!rId){
    res.send({
      code:3,
      msg:"缺少必传参数：rId"
    })
    return;
  }

  const newData = {};
  if(number) newData.number = number-0;
  if(config) newData.config = config.replace(/[\s,，]+/g, ",").split(",");
  if(rName) newData.rName = rName;
  if(state) newData.state = state=="0" ? false : true;

  await meet.updateMany({rId}, newData);

  res.send({
    code:1,
    msg:"修改成功"
  })
}